<?php

/**
 * DecPersona form base class.
 *
 * @method DecPersona getObject() Returns the current form's model object
 *
 * @package    PhpProject1
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseDecPersonaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'per_id'                       => new sfWidgetFormInputHidden(),
      'per_credenciales_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DecCredenciales'), 'add_empty' => true)),
      'per_pais_id'                  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DecPais'), 'add_empty' => true)),
      'per_tipo_documento_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DecTipoDocumento'), 'add_empty' => true)),
      'per_primer_nombre'            => new sfWidgetFormInputText(),
      'per_segundo_nombre'           => new sfWidgetFormInputText(),
      'per_primer_apellido'          => new sfWidgetFormInputText(),
      'per_segundo_apellido'         => new sfWidgetFormInputText(),
      'per_nombre_completo'          => new sfWidgetFormTextarea(),
      'per_identificacion_documento' => new sfWidgetFormTextarea(),
      'per_telefono'                 => new sfWidgetFormInputText(),
      'per_direccion'                => new sfWidgetFormTextarea(),
      'per_fecha_nacimiento'         => new sfWidgetFormDate(),
      'per_sexo'                     => new sfWidgetFormChoice(array('choices' => array('MASCULINO' => 'MASCULINO', 'FEMENINO' => 'FEMENINO'))),
      'per_email'                    => new sfWidgetFormInputText(),
      'per_es_admin'                 => new sfWidgetFormInputText(),
      'per_es_empleado'              => new sfWidgetFormInputText(),
      'per_es_cliente'               => new sfWidgetFormInputText(),
      'per_activo'                   => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'per_id'                       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('per_id')), 'empty_value' => $this->getObject()->get('per_id'), 'required' => false)),
      'per_credenciales_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('DecCredenciales'), 'required' => false)),
      'per_pais_id'                  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('DecPais'), 'required' => false)),
      'per_tipo_documento_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('DecTipoDocumento'), 'required' => false)),
      'per_primer_nombre'            => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'per_segundo_nombre'           => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'per_primer_apellido'          => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'per_segundo_apellido'         => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'per_nombre_completo'          => new sfValidatorString(array('required' => false)),
      'per_identificacion_documento' => new sfValidatorString(array('required' => false)),
      'per_telefono'                 => new sfValidatorInteger(array('required' => false)),
      'per_direccion'                => new sfValidatorString(array('required' => false)),
      'per_fecha_nacimiento'         => new sfValidatorDate(array('required' => false)),
      'per_sexo'                     => new sfValidatorChoice(array('choices' => array(0 => 'MASCULINO', 1 => 'FEMENINO'), 'required' => false)),
      'per_email'                    => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'per_es_admin'                 => new sfValidatorInteger(array('required' => false)),
      'per_es_empleado'              => new sfValidatorInteger(array('required' => false)),
      'per_es_cliente'               => new sfValidatorInteger(array('required' => false)),
      'per_activo'                   => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('dec_persona[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'DecPersona';
  }

}
